/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine.hal.devicealias.echo;

import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.CenterOfMassPosition;
import it.free.i.virtual.swarm.ComposableInformationUnit;
import it.free.i.virtual.swarm.ComposableInformationUnit.CIUGeneratorAllowedOperations;

/**  
 * CollisionEcho DTO impl
 * @author stefano
 */
public class CollisionEchoImpl extends EchoImpl implements CollisionEcho {

	private int impactedObjectType = 0;
	private String impactedObjectDescription = null;
	private CenterOfMassPosition centerOfMassPosition = null;
	
	public CollisionEchoImpl() {
		super();
	}

	/**
	 * @return the impactedObjectType
	 */
	public int getImpactedObjectType() {
		return impactedObjectType;
	}

	/**
	 * @param impactedObjectType the impactedObjectType to set
	 */
	public void setImpactedObjectType(int impactedObjectType) {
		this.impactedObjectType = impactedObjectType;
	}

	/**
	 * @return the impactedObjectDescription
	 */
	public String getImpactedObjectDescription() {
		return impactedObjectDescription;
	}

	/**
	 * @param impactedObjectDescription the impactedObjectDescription to set
	 */
	public void setImpactedObjectDescription(String impactedObjectDescription) {
		this.impactedObjectDescription = impactedObjectDescription;
	}

	/**
	 * @return the centerOfMassPositionImpl
	 */
	public CenterOfMassPosition getCenterOfMassPosition() {
		return centerOfMassPosition;
	}

	/**
	 * @param centerOfMassPosition the centerOfMassPositionImpl to set
	 */
	public void setCenterOfMassPosition(CenterOfMassPosition centerOfMassPosition) {
		this.centerOfMassPosition = centerOfMassPosition;
	}

	public ComposableInformationUnit getRenderedObjectImage() {
		
		ComposableInformationUnit composableInformationUnit = ComposableInformationUnit.Factory.createObject();
		
		composableInformationUnit.setAttribute("centerOfMassPosition.X", this.centerOfMassPosition.getX());
		composableInformationUnit.setAttribute("centerOfMassPosition.Y", this.centerOfMassPosition.getY());
		composableInformationUnit.setAttribute("centerOfMassPosition.Z", this.centerOfMassPosition.getZ());
		composableInformationUnit.setAttribute("impactedObjectDescription", this.impactedObjectDescription);
		composableInformationUnit.setAttribute("impactedObjectType", this.impactedObjectType);
		composableInformationUnit.setAllowedOperations(CIUGeneratorAllowedOperations.READ);
		
		composableInformationUnit.setCiuType(this.getClass().getName());
		
		return composableInformationUnit;
	}
}
